package com.vshop.timingtask;

import com.vshop.entity.comentity.DataReading;
import com.vshop.mapper.DataReadingMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lm
 * @date 2021/1/27 17:35
 */
@RestController
@Slf4j
public class DataReadingTask {
    @Resource
    DataReadingMapper dataReadingMapper;

    @GetMapping(value = "dataReading")
    public void task() {
        List<DataReading> dataList = dataReadingMapper.dataReading();
        for (DataReading data : dataList) {
            Integer count = dataReadingMapper.updateDevicePackagesRelation(data.getDeviceCode(), "LP20210706002900","partner_device_packages_relation_t_9");
            if (count > 0) {
                log.info(data.getDeviceCode() + "：更新成功");
            }
        }
    }
}
